package com.springbootblog.dao;

import com.springbootblog.dao.sqlBuilder.FriendLinkSqlBuilder;
import com.springbootblog.pojo.Friendlink;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.SelectProvider;

import java.util.List;

@Mapper
public interface FriendLinkDao
{
    @SelectProvider(type = FriendLinkSqlBuilder.class, method = "getFriendLinkList")
    List<Friendlink> getFriendLinkList();

    @SelectProvider(type = FriendLinkSqlBuilder.class, method = "getMaxSortNo")
    Integer getMaxSortNo();

    /**
     * 添加友联
     * @param friendlink
     * @return
     */
    @InsertProvider(type = FriendLinkSqlBuilder.class, method = "applyFriendLink")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    Integer applyFriendLink(Friendlink friendlink);
}
